home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Diagonal wipe.c < prev    next >
Text File  |  1993-08-23  |  2KB  |  54 lines

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define BoxSize 13
  15. #define CorrectTime 2
  16.  
  17. void DiagonalWipe(GrafPtr);
  18.  
  19. /* If you make a long enough region starting at the bottomright corner and
  20.    making a strip up and right of <BoxSize> width, all you have to do is move
  21.    the region left until the entire screen is filled.  Dave thinks ideas like
  22.    this should be taken out and shot, but it works. */
  23.    
  24. void DiagonalWipe(GrafPtr sourceGrafPtr)
  25. {
  26.     int            counter,maxmax;
  27.     Rect        source;
  28.     RgnHandle    archie;
  29.     
  30.     maxmax=MAIN_WINDOW_WIDTH+BoxSize;
  31.     archie=NewRgn();
  32.     OpenRgn();
  33.         MoveTo(MAIN_WINDOW_WIDTH+BoxSize,MAIN_WINDOW_HEIGHT+BoxSize);
  34.         Line(0,BoxSize);
  35.         Line(-maxmax,maxmax);
  36.         Line(-BoxSize,0);
  37.         Line(maxmax,-maxmax);
  38.     CloseRgn(archie);
  39.     source.top=source.left=0;
  40.     source.bottom=MAIN_WINDOW_HEIGHT;
  41.     source.right=MAIN_WINDOW_WIDTH;
  42.  
  43.     /* the only tricky part to this code is the starting param for counter */
  44.     for (counter=2+(MAIN_WINDOW_WIDTH+MAIN_WINDOW_HEIGHT)/BoxSize; counter>=0; counter--)
  45.     {
  46.         StartTiming();
  47.         OffsetRgn(archie,0,-BoxSize);
  48.         CopyBits(&(sourceGrafPtr->portBits),&(gMainWindow->portBits),&source,&source,
  49.             0,archie);
  50.         TimeCorrection(CorrectTime);
  51.     }
  52.     DisposeRgn(archie);
  53. }
  54.